Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: streamline ReporterTestResult and imagesInfo types #526

Merged
merged 7 commits into from
Jan 9, 2024

Conversation

shadowusr
Copy link
Member

@shadowusr shadowusr commented Dec 18, 2023

What's done?

  • Got rid of all ...TestResult types in favor of universal ReporterTestResult
  • Got rid of assertViewResults field in ReporterTestResult
  • Got rid of image-handler and made formatting imagesInfo a lot easier
  • Got rid of global caches and implemented Cache class instead
  • Implemented images-info-saver which performs saving of screenshots and updating paths, it's an almost complete re-write of the old image-handler
  • Implemented SqliteTestAdapter, which can parse sqlite rows directly into ReporterTestResult

Why?

  • Having a single a single interface like ReporterTestResult greatly simplifies the way you think about, alter and process test results across the whole app
  • Similarly, having a single imagesInfo format makes it easy to support different tools and keep track of screenshots data in general
  • Having explicit cache classes as well as more straightforward formatting of images makes it significantly easier to deal with image data

⚠️ Review tips ⚠️

Main chunks of changes:

  1. images-info-saver — the idea of this class is to accept imagesInfo array, save images and return imagesInfo with updated paths
  2. test adapters now format imagesInfo on their own, without help of external utils, because each adapter transforms unique object shape to ReporterTestResults' imagesInfo
  3. Removed PreparedTestResult and similar types as well as add...() methods from report builders, it's pretty obvious
  4. Other than that, very little has changed. A few enhancements here and there and tests, should be simple enough!

@shadowusr shadowusr marked this pull request as draft December 18, 2023 23:57
@shadowusr shadowusr force-pushed the users/shadowusr/1004.get-rid-of-prepared-result-2 branch from 7d7ee9b to 400731c Compare December 19, 2023 22:27
@shadowusr shadowusr force-pushed the users/shadowusr/1004.get-rid-of-prepared-result-2 branch from 400731c to bbe2428 Compare December 20, 2023 23:25
@shadowusr shadowusr changed the title Users/shadowusr/1004.get rid of prepared result 2 refactor: streamline ReporterTestResult and imagesInfo types Dec 20, 2023
@shadowusr shadowusr force-pushed the users/shadowusr/1004.get-rid-of-prepared-result-2 branch from 78909a4 to d0b04cb Compare December 20, 2023 23:51
lib/types.ts Outdated Show resolved Hide resolved
@shadowusr shadowusr marked this pull request as ready for review December 21, 2023 00:11
@shadowusr shadowusr requested a review from DudaGod December 21, 2023 00:11
Copy link
Member

@DudaGod DudaGod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В остальном /ok

hermione.ts Outdated Show resolved Hide resolved
hermione.ts Show resolved Hide resolved
lib/cache.ts Show resolved Hide resolved
lib/gui/tool-runner/index.ts Outdated Show resolved Hide resolved
lib/gui/tool-runner/index.ts Outdated Show resolved Hide resolved
lib/test-adapter/playwright.ts Show resolved Hide resolved
lib/test-adapter/sqlite.ts Outdated Show resolved Hide resolved
lib/types.ts Outdated Show resolved Hide resolved
lib/types.ts Outdated Show resolved Hide resolved
test/unit/lib/images-info-saver.ts Show resolved Hide resolved
@shadowusr shadowusr merged commit 8b4a458 into master Jan 9, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants